Step 16: Test a GET request

Update tests/routes/bookmakrs.test.js and rewrite the following test:

  it("GET a bookmark given its ID", async () => {
    const index = Math.floor(Math.random() * numBookmarks);
    const bookmark = bookmarkDao.readAll({})[index];
    const response = await request.get(`/bookmarks/${bookmark.id}`);
    expect(response.status).toBe(200);
    expect(response.body.data).toMatchObject(bookmark);
  });

Run the tests in this file.

Untitled

Save and commit all changes.